package com.taotao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EasyUIDataGridResult;
import com.taotao.common.utils.UniResult;
import com.taotao.service.ItemParamService;

@Controller
@RequestMapping("/item/param")
public class ItemParamController {

	@Autowired
	private ItemParamService itemParamService;
	
	@ResponseBody
	@RequestMapping("/query/itemcatid/{cid}")
	public UniResult getItemCatByCid(@PathVariable Long cid) {
		UniResult result = itemParamService.getItemParamByCid(cid);
		return result;
	}
	
	/**
	 * 查询分页
	 * @param page
	 * @param rows
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/list")
	public EasyUIDataGridResult getParamList(Integer page, Integer rows) {
		EasyUIDataGridResult result = itemParamService.getParamList(page, rows);
		return result;
	}
	
	/**
	 * 保存
	 * @param cid
	 * @param paramData
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/save/{cid}")
	public UniResult insertItemParam(@PathVariable Long cid, String paramData) {
		UniResult result = itemParamService.insertItemParam(cid, paramData);
		return result;
	}

}

